package com.jfinal.aceadmin.morepage;

import com.jfinal.aceadmin.model.EmailImpl;
import com.jfinal.aceadmin.model.FollowImpl;
import com.jfinal.aceadmin.model.User;
import com.jfinal.aceadmin.vo.FollowInfoVo;
import com.jfinal.aceadmin.vo.InboxVo;
import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Record;

public class MorePageController extends Controller {

	public void timeline() {

		render("timeline.html");
	}

	public void pricingTable() {

		render("pricing_table.html");
	}

	public void inbox() {
		String name = getSessionAttr("name");
		User user = User.dao.findByName(name);
		InboxVo inboxVo = EmailImpl.getDAO().getUserEmails(user.getId());
		setAttr("inboxVo", inboxVo);
		render("inbox.html");
	}

	public void invoice() {

		render("invoice.html");
	}

	public void profile() {

		String name = getSessionAttr("name");
		Record user = User.dao.findByAttrUnique("name", name);
		FollowInfoVo followVo = FollowImpl.getDAO().getUserFollowInfo(
				user.getInt("id"));
		setAttr("user", user);
		setAttr("followVo", followVo);
		render("profile.html");
	}

	public void login() {

		render("login.html");
	}
}
